/**
 * outsider.com.cn Inc.
 * Copyright (c) 2011-2022 All Rights Reserved.
 */
package com.yuanmeng.common.core.enums;

import lombok.Getter;

/**
 * @author outsider
 * @version Id: StatusEnum.java, v 0.1 2022/6/1 17:16 outsider Exp $$
 */
@Getter
public enum CommunityOrderStatusEnum {
    WAITING_PAY("WAITING_PAY", "待支付"),

    PAY_FAILED("PAY_FAILED", "支付失败"),

    PENDING_ORDER("PENDING_ORDER", "待接单"),

    IN_STOCK("IN_STOCK", "备货中"),

//    WAITING_DELIVERY("WAITING_DELIVERY", "待配送"),

    DELIVERY_PROGRESS("DELIVERY_PROGRESS", "配送中"),

    WAITING_CONFIRM_RECEIPT("WAITING_CONFIRM_RECEIPT", "待确认收货"),

    PENDING_EXPENSES("PENDING_EXPENSES", "待消费"),

    WAITING_COMMENT("WAITING_COMMENT", "待评价"),

    TRANSACTION_CLOSED("TRANSACTION_CLOSED", "交易关闭 - 已取消"),

    TRANSACTION_COMPLETED("TRANSACTION_COMPLETED", "交易成功"),

    AFTER_SALES("AFTER_SALES", "售后中");

    private String code;

    private String message;

    CommunityOrderStatusEnum(String code, String message) {
        this.code = code;
        this.message = message;
    }

    public static String codeQueryValue(String orderStatus) {
        for(CommunityOrderStatusEnum ENUM : CommunityOrderStatusEnum.values()) {
            if(ENUM.code.equals(orderStatus)) {
                return ENUM.getMessage();
            }
        }
        return "";
    }

    public static String valueQueryCode(String orderStatusValue) {
        for(CommunityOrderStatusEnum ENUM : CommunityOrderStatusEnum.values()) {
            if(ENUM.message.equals(orderStatusValue)) {
                return ENUM.getCode();
            }
        }
        return "";
    }
}